package com.koro.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.koro.annotation.*;
import com.koro.constants.MySqlTypeConstant;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.math.BigDecimal;

@Data
@TableName("t_goods")
@Table(name = "t_goods")
@TableComment("商品管理")
@Document(indexName = "es_goods")
public class Goods {

    @TableId(value = "id",type = IdType.AUTO)
    @Column(name = "id",type = MySqlTypeConstant.INT,isKey = true,isAutoIncrement = true)
    @ColumnComment(value = "商品id")
    @Id
    private Integer id;

    @Column(name = "goods_name",type = MySqlTypeConstant.VARCHAR,length = 30)
    @ColumnComment(value = "商品名称")
    @Excel(name = "商品名称")
    @Field(analyzer = "ik_max_word", type = FieldType.Text)
    private String goodsName;

    @Column(name = "price",type = MySqlTypeConstant.DECIMAL,length = 18, decimalLength = 6)
    @ColumnComment(value = "商品价格")
    @Excel(name = "商品价格")
    private BigDecimal price;

    @Column(name = "stock",type = MySqlTypeConstant.INT,length = 10)
    @ColumnComment(value = "库存")
    @Excel(name = "库存")
    private Integer stock;

}
